lib/pull: Avoid error if current with --require-static-deltas
authorColin Walters <walters@verbum.org>
Fri, 3 Nov 2017 18:43:00 +0000 (18:43 +0000)
committerAtomic Bot <atomic-devel@projectatomic.io>
Mon, 6 Nov 2017 19:41:07 +0000 (19:41 +0000)
commit015513b8f979ab0769ad36da868544378e553041
tree43324a4cbec5cc42cb0960ad5ed9269018c98dc6
parent7296bf3dcc190d6d137790ff3f40f147e6ef742f
lib/pull: Avoid error if current with --require-static-deltas

A tricky thing here that caused this to go past a lot of our tests
is that the code was mostly OK if there was an available delta from
an older commit.  But this case broke if we e.g. had a new OS
deployment and did a `--require-static-deltas` pull, i.e. the initial
state.

I cleaned up our "find static delta state" function to return an enumeration,
and extended it with an "already have the commit" state.  A problem
I then hit is that we've historically fetched detached metadata for
non-delta pulls, even if the commit hasn't changed.  I decided not to
do that for `--require-static-deltas` pulls for now; otherwise the
code gets notably more complex.

Closes: https://github.com/ostreedev/ostree/issues/1321
Closes: #1323
Approved by: jlebon
src/libostree/ostree-repo-pull.c
tests/pull-test.sh